#!/usr/bin/node

const fs = require('fs'),
      http = require('http'),
      pic = process.argv[2];
//validate


let data = fs.readFileSync(pic);
let uri = data.toString('base64');


let html = `<html><head><title>data url</title></head><body><img src="data:image/jpg;base64,${uri}" /></body></html>`;

http.createServer((req,res) => {
  res.end(html);
}).listen(8080);
